import fetch from "@/utils/fetch";

// 说明：字典封装
// 接口：api/cb/flDmaZone
// 请求类型：Post
export function getTSType(TypeGroupCode) {
    return fetch({
        url: `api/admin/tSType/Code${TypeGroupCode}`,
        method: "get",
    });
}

// 说明：字典封装--跨表查询
// 接口：api/cb/flDmaZone
// 请求类型：Post
// export function getTSTypeTable(Table,id,name,associated) {
//     return fetch({
//         url: `api/admin/tSType/Table${Table}/${id}/${name}/${associated}`,
//         method: 'get'
//     });
// }
// export function getTSTypeTable(table, id, name, associated) {
//     return fetch({
//         url: `api/admin/tSType/Table?table=${table}&id=${id}&name=${name}&associated=${associated}`,
//         method: "post",
//         data: {
//             table,
//             id,
//             name,
//             associated,
//         },
//     });
// }
export function getTSTypeTable(table, id, name, associated) {
    return fetch({
        url: `api/schedule/flCommunity/Table?table=${table}&id=${id}&name=${name}&associated=${associated}`,
        method: "post",
        data: {
            table,
            id,
            name,
            associated,
        },
    });
}

// 说明：NBiot 字典封装--跨表查询
// 接口：api/cb/tableDict/getTableData
// 请求类型：Post
// export function getTSTypeTable(Table,id,name,associated) {
//     return fetch({
//         url: `api/admin/tSType/Table${Table}/${id}/${name}/${associated}`,
//         method: 'get'
//     });
// }
export function getNbiotTSTypeTable(table, id, name, associated) {
    return fetch({
        url: `api/nbiot/tableDict/getTableData?table=${table}&id=${id}&name=${name}&associated=${associated}`,
        method: "post",
        data: {
            table,
            id,
            name,
            associated,
        },
    });
}

// 字典封装优化
// POST /tSType/code
export function getTSTypePlus(arr) {
    return fetch({
        url: `api/admin/tSType/code?code=${arr}`,
        method: "post",
    });
}

// POST /tSType/BusinessTable
// 营收表名查询
export function BusinessTable(table, id, name, associated) {
    return fetch({
        url: `api/admin/tSType/BusinessTable?table=${table}&id=${id}&name=${name}&associated=${associated}`,
        method: "post",
        data: {
            table,
            id,
            name,
            associated,
        },
    });
}

// 调度表字典查询
export function ScheduleTable(table, id, name, associated) {
    // console.log(table, id, name, associated)
    // debugger;
    return fetch({
        url: `api/schedule/tableDict/getTableData?table=${table}&id=${id}&name=${name}&associated=${associated}`,
        method: "post",
        data: {
            table,
            id,
            name,
            associated,
        },
    });
}

// 集抄平台表字典查询
export function CollectionTable(table, id, name, associated) {
    return fetch({
        url: `api/collection/tableDict/getTableData?table=${table}&id=${id}&name=${name}&associated=${associated}`,
        method: "post",
        data: {
            table,
            id,
            name,
            associated,
        },
    });
}